<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
#l-map{height:100%;width:78%;float:left;border-right:1px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
<title>折线</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("allmap");
var point = new BMap.Point(116.404, 39.915);
map.centerAndZoom(point, 15);
map.addControl(new BMap.ScaleControl({anchor: BMAP_ANCHOR_BOTTOM_LEFT})); // 左下
map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件

var polyline = new BMap.Polyline([
  new BMap.Point(116.405, 39.915),
  new BMap.Point(116.406, 39.916),
  new BMap.Point(116.407, 39.917),
  new BMap.Point(116.408, 39.918),
  new BMap.Point(116.409, 39.919),
  new BMap.Point(116.410, 39.920),
  new BMap.Point(116.411, 39.921),
  new BMap.Point(116.412, 39.922),
  new BMap.Point(116.413, 39.923),
  new BMap.Point(116.414, 39.924),
  new BMap.Point(116.415, 39.925),
  new BMap.Point(116.416, 39.926),
  new BMap.Point(116.417, 39.927)    
], {strokeColor:"#00FF00", strokeWeight:3, strokeOpacity:0.5});

map.addOverlay(polyline);

polyline = new BMap.Polyline([
  new BMap.Point(116.417, 39.927),
  new BMap.Point(116.419, 39.927),
  new BMap.Point(116.420, 39.927),
  new BMap.Point(116.421, 39.927),
  new BMap.Point(116.422, 39.927),
  new BMap.Point(116.423, 39.927),
  new BMap.Point(116.424, 39.927),
  new BMap.Point(116.425, 39.927),
  new BMap.Point(116.426, 39.927),
  new BMap.Point(116.427, 39.927),
  new BMap.Point(116.428, 39.927),
  new BMap.Point(116.429, 39.927),
  new BMap.Point(116.430, 39.927)    
], {strokeColor:"#FF0000", strokeWeight:3, strokeOpacity:0.5});

map.addOverlay(polyline);
map.removeOverlay(polyline);

</script>
